﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IHISCETeim.DAL;
using IHISCETeim.Model;
using IHISCETeim.Library;
using System.Data;


namespace IHISCETeim.BLL
{
    public class OCompletingCheckController : BaseController
    {
        public static bool Add(OCompletingCheckInfo obj, List<ONGInspectionInfo> NGItems)
        {
            return OCompletingCheckDAL.Add(obj, NGItems);
        }
        public static bool Update(OCompletingCheckInfo obj, List<ONGInspectionInfo> NGItems)
        {
            Delete(obj.CCID);
            return OCompletingCheckDAL.Add(obj, NGItems);
        }
        public static bool Delete(int CCID)
        {
            return OCompletingCheckDAL.Delete(CCID);
        }
        public static OCompletingCheckInfo GetById(int Id)
        {
            return CBO.FillObject<OCompletingCheckInfo>(OCompletingCheckDAL.GetById(Id));
        }
        public static DataTable GetPagination(string WhereSql, int PageIndex, int PageSize, string Sort, ref int TotalCount)
        {
            return OCompletingCheckDAL.GetPagination(WhereSql, PageIndex, PageSize, Sort, ref  TotalCount);
        }

        public static DataTable OCompletingCheck_ExportNGListByDate(string FormDate, string ToDate)
        {
            return OCompletingCheckDAL.OCompletingCheck_ExportNGListByDate(FormDate, ToDate);
        }

         /// <summary>
        /// 判断完成检查书中，相关号码是否已存在
        /// 1为存在，0不存在
        /// </summary>
        /// <returns></returns>
        public static int OCompletingCheck_GetCheckUniqueNum(string ColumnName, string ColumnValue)
        {
            return OCompletingCheckDAL.OCompletingCheck_GetCheckUniqueNum(ColumnName, ColumnValue);
        }
    }
}
